var tgd = tgd || {};
tgd.Simulations = tgd.Simulations || {};
tgd.Simulations.Zombies = tgd.Simulations.Zombies || {};

tgd.Simulations.Zombies.Controller = function (w, h, v) {

	this._view = v;
	this._sim = new tgd.Simulations.Zombies.Simulation({Height : h, Width : w, RefreshRate : 1 });

	if (tgd.Simulations.Zombies.Controller._initialized === undefined) {

		tgd.Simulations.Zombies.Controller.prototype.start = function() {
			var self = this;

			this._sim.onRefresh = function(opts) { self._view.onRoundSimulated(opts); }

			this._sim.start();
		}

        tgd.Simulations.Zombies.Controller.prototype.stop = function() {
            this._sim.stop();
        }

        tgd.Simulations.Zombies.Controller.prototype.add = function(num, type) {
			for (var i = 0; i < num; ++i) {
				this._sim.add(type);
			}
        }

		tgd.Simulations.Zombies.Controller._initialized = true;
	}
}
